package com.guchenbo.study.mvc.servlet31.springmvc;

import com.guchenbo.study.mvc.servlet31.springmvc.servlet.ServletConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

import java.util.regex.Pattern;

/**
 * @Author guchenbo
 * @Date 2019/12/1.
 */
@Configuration
@ComponentScan(basePackageClasses = RootConfiguration.class, excludeFilters = {
                @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.guchenbo.study.mvc.servlet31.springmvc.servlet.*") })
public class RootConfiguration {

    @Bean
    public SpringStudyFilter springStudyFilter() {
        return new SpringStudyFilter();
    }

    @Bean
    public StudyService studyService() {
        return new StudyServiceImpl();
    }

    public static void main(String[] args) {
        Pattern pattern = Pattern.compile("com.guchenbo.study.mvc.servlet31.springmvc.servlet.*");
        System.out.println(pattern.matcher(ServletConfiguration.class.getName()).matches());
    }
}
